package com.ytc.restcontroller;

import com.ytc.mapper.BookhistoryMapper;
import com.ytc.model.Bookhistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 详细介绍类情况.
 *
 * @ClassName BookhistoryServiceImpl
 * @Author zk
 * @Date 2023/1/13
 * @Version 1.0
 */
@RestController
public class BookhistoryServiceImpl {

    @Autowired
    private BookhistoryMapper bookhistoryMapper;

    /**
     * 张阔:查询历史记录
     * @param uId
     * @param blId
     * @return cid 章节id
     */
    @RequestMapping("queryBhByUidAndBlid")
    public Integer queryBhByUidAndBlid(@RequestParam("uId") Integer uId, @RequestParam("blId") Integer blId){
        return bookhistoryMapper.queryBhByUidAndBlid(uId,blId);
    }

    //张阔：新增历史记录
    @RequestMapping("addHistory")
    public void addHistory(@RequestParam("uid") Integer uid,@RequestParam("bid") Integer bid,@RequestParam("cid") Integer cid){
        bookhistoryMapper.addHistory(uid,bid,cid);
    }

    //张阔：修改历史记录
    @RequestMapping("updateHistory")
    public void updateHistory(@RequestParam("uid") Integer uid,@RequestParam("bid") Integer bid,@RequestParam("cid") Integer cid){
        bookhistoryMapper.updateHistory(uid,bid,cid);
    }
}
